﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using QxFramework.Utilities;
using QxFramework.Core;
//using static K_HeaveyAttack;
using System;

public class K_HA_AnmEv : BulletBase
{
    public Vector2 dir;
    public Vector2 pos;
    

    public override void Init(SkillBase skill, Vector2 pos)
    {
        this.dir = dir;
        this.pos = pos;
        transform.position = pos;
        attackInfo = new AttackInfo();
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.gameObject.tag == "Enemy")
        {
            hitList.Add(collision.gameObject.GetComponent<EntityBase>());
            attackInfo.targets = hitList;
            MessageManager.Instance.Get<K_HvyAtk_Event>().DispatchMessage(K_HvyAtk_Event.Damage, this, attackInfo);
            hitList.Clear();
        }
        
    }
    public void Stop()
    {
        MessageManager.Instance.Get<K_HvyAtk_Event>().DispatchMessage(K_HvyAtk_Event.Stop, this);
        Debug.Log("Stop");
        EffectManager.Instance.RecycleEffect(this.gameObject);
    }
}

